package org.example;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.TimeUnit;

/**
 * Hello world!
 *
 */
@SpringBootApplication
public class App 
{

    private static final Logger logger = LoggerFactory.getLogger(App.class);

    public static void main( String[] args )
    {
        SpringApplication.run(App.class,args);

//        new Timer().schedule(new TimerTask() {
//            @Override
//            public void run() {
//                logger.info("current clientNum={}", WebSocketServer.getWebSocketMap().keySet().size());
//            }
//        }, 0, 1000);

        while (true) {
            logger.info("current clientNum={}", WebSocketServer.getWebSocketMap().keySet().size());
            try {
                TimeUnit.SECONDS.sleep(1);
            } catch (InterruptedException e) {
                logger.error(e.getMessage(),e);
            }
        }
    }
}
